{extend name="admin@index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">分类列表</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
        </div>
    </div>
</div>
<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
      <a class="layui-btn layui-btn-normal layui-btn-sm" href="{:url('links/links/index')}">链接管理</a>
    </div>
</script>
<script type="text/html" id="barTool">
    <a class="layui-btn layui-btn-xs" href='{:url("termsedit")}?id={{ d.id }}'>编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del" href='{:url("termsdelete")}?id={{ d.id }}'>删除</a>
</script>
{/block}
{block name="script"}
<script>
    var options = {
        id: 'dataTable',
        formId: 'searchForm',
        toolbar: '#toolbarDemo',
        url: '{:url("links/links/terms")}',
        page: false,   //分页设置
        sortOrder: '', //排序方式  asc: 升序、desc: 降序、null: 默认排序
        cols: [
            [
                { field: 'id', width: 70, title: 'ID' },
                { field: 'name', title: '分类名称'},
                { fixed: 'right', width: 150, title: '操作', toolbar: '#barTool' }
            ]
        ],
        done: function(res, curr, count){}, //表格数据渲染完的回调
    };
    // 搜索
    options.searchParams = function(){
        var formData = $.table._searchFormData();
        var data = {};
        data = $.extend(formData, data);
        return data;
    };
    // 加载layui表格
    $.table.init(options);
</script>
{/block}